package com.cn.ccp.bean;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;

import com.cn.ccp.action.BaseAction;
import com.cn.ccp.util.CCPContants;

/**
 * 课程留言
 * @author Administrator
 *
 */
public class CourseIssueBean {

	private int id ;
	private String course_id ;
	private String courseName ;
	
	private String student_id ;
	private String studentName ;
	
	private String teacher_id ;
	private String teacherName; 
	
	private String issue_type ;
	private String write_time ;
	
	private String issue ;
	
	private String issue_id ;
	
	private String msg ;
	
	private String answerMsg ;
	
	private List<CourseIssueBean> ccList ;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCourse_id() {
		return course_id;
	}

	public void setCourse_id(String course_id) {
		this.course_id = course_id;
	}

	public String getCourseName() {
		return courseName;
	}

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}

	public String getStudent_id() {
		return student_id;
	}

	public void setStudent_id(String student_id) {
		this.student_id = student_id;
	}

	public String getStudentName() {
		return studentName;
	}

	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}

	public String getTeacher_id() {
		return teacher_id;
	}

	public void setTeacher_id(String teacher_id) {
		this.teacher_id = teacher_id;
	}

	public String getTeacherName() {
		return teacherName;
	}

	public void setTeacherName(String teacherName) {
		this.teacherName = teacherName;
	}

	public String getIssue_type() {
		return issue_type;
	}

	public void setIssue_type(String issue_type) {
		this.issue_type = issue_type;
	}

	public String getWrite_time() {
		return write_time;
	}

	public void setWrite_time(String write_time) {
		this.write_time = write_time;
	}

	public String getIssue_id() {
		return issue_id;
	}

	public void setIssue_id(String issue_id) {
		this.issue_id = issue_id;
	}

	public String getIssue() {
		return issue;
	}

	public void setIssue(String issue) {
		this.issue = issue;
	}

	public List<CourseIssueBean> getCcList() {
		if(ccList == null)
			ccList = new ArrayList<CourseIssueBean>();
		return ccList;
	}

	public void setCcList(List<CourseIssueBean> ccList) {
		this.ccList = ccList;
	} 

	public String getAnswerMsg() {
		boolean isToday = false;
		try {
			isToday = CCPContants.isToday(CCPContants.sdf2.parse(getWrite_time()));
		} catch (ParseException e) {
			e.printStackTrace();
		}
		String answerMsg = getWrite_time();
		if(isToday)
			answerMsg = BaseAction.getInstance().getMessages("label_today")+" <small>"+getWrite_time().split(" ")[1]+"</small>";
		if(issue_type.equalsIgnoreCase("1"))
			answerMsg = getStudentName()+"："+answerMsg;
		else
			answerMsg = CCPContants.getUserBean().getUserName()+"："+answerMsg;
			
		return answerMsg;
	}

	public void setAnswerMsg(String answerMsg) {
		this.answerMsg = answerMsg;
	}

	public String getMsg() {
		boolean isToday = false;
		try {
			isToday = CCPContants.isToday(CCPContants.sdf2.parse(getWrite_time()));
		} catch (ParseException e) {
			e.printStackTrace();
		}
		String msg = getWrite_time();
		if(isToday)
			msg = BaseAction.getInstance().getMessages("label_today")+" <small>"+getWrite_time().split(" ")[1]+"</small>";
		
		msg = getTeacherName()+BaseAction.getInstance().getMessages("user_page_label_user_type_teacher")+"："+msg;
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
}
